package base.thread.pool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @Author: my_code
 * @Create: 2020-12-09 15:47
 *
 * 没有返回值用execute(Runnable runnable)
 */
public class TestPool1 {
    public static void main(String[] args) {

        ExecutorService service = Executors.newFixedThreadPool(4);

        service.execute(new MyThread());
        service.execute(new MyThread());
        service.execute(new MyThread());
        service.execute(new MyThread());

        service.shutdown();
    }
}
class MyThread implements Runnable{

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName());
    }
}